package o;

import android.app.Activity;
import android.content.Context;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import com.huawei.appgallery.foundation.card.base.bean.BaseDistCardBean;
import com.huawei.updatesdk.service.otaupdate.UpdateStatusCode.DialogButton;

public class eci implements dmi, AccountBussinessListener {
    private BaseDistCardBean ˊ;
    private o.djr.e ˎ;
    private Context ˏ;

    class e implements eck {
        final /* synthetic */ eci ˊ;

        private e(eci o_eci) {
            this.ˊ = o_eci;
        }

        public void ˎ(c cVar, String str, String str2) {
            if (cVar == c.Success) {
                this.ˊ.ˊ.ˏॱ(str);
                this.ˊ.ˊ.ˏ(str2);
                if (this.ˊ.ˎ != null) {
                    this.ˊ.ˎ.ॱ(null, this.ˊ.ˊ);
                }
            } else if (this.ˊ.ˎ != null) {
                this.ˊ.ˎ.ˋ();
            }
        }
    }

    public eci(BaseDistCardBean baseDistCardBean, Context context, o.djr.e eVar) {
        this.ˊ = baseDistCardBean;
        this.ˏ = context;
        this.ˎ = eVar;
    }

    public void ˋ() {
        UserSession instance = UserSession.getInstance();
        if (instance == null || instance.isLoginSuccessful()) {
            ˏ();
            return;
        }
        eoj.ˋ().ˎ(this.ˊ.ͺˏ(), this);
        eod.ˊ(this.ˏ, null, false, true, true);
    }

    private void ˏ() {
        if (this.ˏ == null || !(this.ˏ instanceof Activity)) {
            Logger.ˋ("PayAuthenticate", "sendPayRequest interupte becauseof context not instanceof Activity");
        } else if (!new ecc((Activity) this.ˏ).ˎ(this.ˊ, new e()) && this.ˎ != null) {
            this.ˎ.ˋ();
        }
    }

    public void run() {
        ˏ();
    }

    public void onAccountBusinessResult(ccp o_ccp) {
        if (Logger.ˎ()) {
            Logger.ˏ("PayAuthenticate", "onAccountBusinessResult accountResult=" + o_ccp + "[" + this.ˊ.v_() + "]");
        }
        if (102 == o_ccp.ˎ) {
            dmq.ॱ.ˊ(this);
        } else if (DialogButton.CONFIRM == o_ccp.ˎ && this.ˎ != null) {
            this.ˎ.ˋ();
        }
        eoj.ˋ().ˊ(this.ˊ.ͺˏ());
    }
}
